{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia pages_tags %}

{% block title %}{% trans "Edit" %}{% endblock %}

{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{% admin_media_prefix %}js/urlify.js"></script>
<script type="text/javascript">var media_url = "{{MEDIA_URL}}"; var page_media_url = "{{PAGES_MEDIA_URL}}"</script>
{% endblock %}

{% block content %}
<!-- Content -->
<div id="content-main">
    {% block object-tools %}
        {% if change and not is_popup %}
            <ul class="object-tools">
                {% if has_absolute_url %}<li><a href="{% show_absolute_url page %}" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif %}
            </ul>
        {% endif %}
    {% endblock %}
    
    <form id="page_form" {% if has_file_field %}enctype="multipart/form-data" {% endif %} action="?language={{ request.GET.language }}{%if request.GET.target %}&amp;target={{ request.GET.target }}{% endif %}&amp;{%if request.GET.target %}position={{ request.GET.position }}{% endif %}" method="post">
        {% comment %}{% csrf_token %}{% endcomment %}
        <div class="sidebar">
        {% for fieldset in adminform %}
            {% include "admin/pages/page/includes/fieldset.html" %}
            
            {% if forloop.first %}
                {% if not add and traduction_languages %}
                <fieldset class="module module-translation-helper aligned">
                    <h2>{% trans "Translation helper" %}</h2>
                    <div class="form-row">
                        <label for="translation-helper-select" class="required">{% trans "Language:" %}</label>
                        <select id="translation-helper-select">
                            <option value="" selected="selected">---------</option>
                            {% for lang in traduction_languages %}
                                <option value="{{ lang.0 }}">{{ lang.1 }}</option>
                            {% endfor %}
                        </select>
                        {% comment %}A little "smart" trick here to have this right column{% endcomment %}
                        <div id="translation-helper-content"></div>
                    </div>
                </fieldset>
                {% endif %}
                
                </div><div class="content">
            {% endif %}
        {% endfor %}
        </div>

        {% for inline_admin_formset in inline_admin_formsets %}
            {% include inline_admin_formset.opts.template %}
        {% endfor %}
        
        {% submit_row %}
    </form>
</div>
<script type="text/javascript" charset="utf-8">
<!--
var add_form = {% if add %}1{% else %}0{% endif %};
(function() {
    /* Hide the Sites options if not needed */
    {% if not PAGE_USE_SITE_ID %}
        $('.form-row.sites').hide();
        $('#id_sites')[0].selectedIndex = 0;
    {% endif %}
})();
-->
</script>
<!-- END Content -->
{% endblock %}
